Skip to content

8160404: RelocationHolder constructors have bugs #3513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bulasevich
Copy link

@bulasevich bulasevich commented Apr 17, 2025

Hi all,

I find this backport problematic. Given the points in [1]/[2]/[3] below, we might want to avoid backporting it.

Rationale
The idea of backporting this change is the following:

  • The change is valuable because it eliminates fragile code paths and prevents potential out-of-bounds memory access
  • There exist other changes that depend (transitively) on this one:
    • JDK 8321509: False positive in get_trampoline fast path causes crash
    • ->JDK-8298913: Add override qualifiers to Relocation classes
    • ->JDK-8160404: RelocationHolder constructors have bugs

[1]
The change requires JDK-8299022, which addresses PPC/S390 build issues. Can we include it as a commit in this PR or it should go as a separate change?

[2]
While working on the backport, I encountered a build issue: the AArch64 cross-compiler reports that Address::_ext is used uninitialized in a copy constructor. This can be resolved with a simple fix (see commit_3). However, I find it concerning that:

  • the same code (with identical gcc options) does not produce a build error on the OpenJDK mainline; and
  • for backporting, the correct approach is to backport existing changes rather than patching gaps with new commits.

[3]
The original patch also modifies the post_call_nop_Relocation and entry_guard_Relocation classes, which are part of:

I do not expect these changes to be backported to jdk17u, so I have excluded those parts in this backport:

@@ -935,29 +996,29 @@ class DataRelocation : public Relocation {
 };

 class post_call_nop_Relocation : public Relocation {
-  friend class RelocIterator;
+  friend class RelocationHolder;

 public:
   post_call_nop_Relocation() : Relocation(relocInfo::post_call_nop_type) { }

   static RelocationHolder spec() {
-    RelocationHolder rh = newHolder();
-    new(rh) post_call_nop_Relocation();
-    return rh;
+    return RelocationHolder::construct<post_call_nop_Relocation>();
   }
+
+  void copy_into(RelocationHolder& holder) const;
 };

 class entry_guard_Relocation : public Relocation {
-  friend class RelocIterator;
+  friend class RelocationHolder;

 public:
   entry_guard_Relocation() : Relocation(relocInfo::entry_guard_type) { }

   static RelocationHolder spec() {
-    RelocationHolder rh = newHolder();
-    new(rh) entry_guard_Relocation();
-    return rh;
+    return RelocationHolder::construct<entry_guard_Relocation>();
   }
+
+  void copy_into(RelocationHolder& holder) const;
 };

 // A CallRelocation always points at a call instruction.

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8160404 needs maintainer approval

Issue

  • JDK-8160404: RelocationHolder constructors have bugs (Bug - P4) ⚠️ Issue is already resolved. Consider making this a "backport pull request" by setting the PR title to Backport <hash> with the hash of the original commit. See Backports.

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/3513/head:pull/3513
$ git checkout pull/3513

Update a local copy of the PR:
$ git checkout pull/3513
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/3513/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3513

View PR using the GUI difftool:
$ git pr show -t 3513

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/3513.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 17, 2025

👋 Welcome back bulasevich! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 17, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

- In copy constructor Address::Address(const Address&)
- assembler_aarch64.hpp:347:7: error: <anonymous>.Address::_ext is used uninitialized in this function
@bridgekeeper
Copy link

bridgekeeper bot commented Jun 13, 2025

@bulasevich This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant